home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-03-01 | 2.8 KB | 63 lines | [TEXT/KAHL] |
- // ProgressBar
-
- /*Adaptive progress bar unit*/
- /*by Ingemar Ragnemalm 1995*/
-
- /*This unit draws a progress bar (for giving the user visual feedback during a long*/
- /*modal operation) in the current port. It works in color if available.*/
-
- /*The difference between this and other progress bars is that this one is ADAPTIVE,*/
- /*giving accurate time indications rather than the number of operations or some*/
- /*arbitrary length.*/
-
- /*You initialize the bar with InitProgressBar, which gives you a pointer to it data.*/
- /*Call AdvanceProgressBar repeatedly during your lengthy operation. Note that you*/
- /*do NOT tell how far it should move each time. AdvanceProgressBar will calculate*/
- /*that for you from the current time. When your lengthy operation is finished, call*/
- /*FinishProgressBar. It will dispose of the pointer and store the final time in the*/
- /*preference folder.*/
-
- /*The first time you run a progress bar, you get a "barber pole" bar, indicating that*/
- /*the expected time is unknown. After that, the time elapsed will be stored, so*/
- /*later progress bars will be accurate. The progress bar is shown if the resource*/
- /*with the expected time did not exist.*/
-
- /*Notes:*/
- /*You must provide the resource fork to your OPEN preference file for storing*/
- /*the total time.*/
- /*If you use several different progress bars, you should use different resID, so that*/
- /*they can store different times.*/
-
-
- /*
- InitProgressBar: Sets up a progress bar and returns a pointer to it.
- Parameters:
- prefFile: File number of an open resource file in which to store preferences.
- resID: Resource number for the resource in which to save. You should use a different number
- for every progress bar your program uses
- bounds: The rectangle in which to draw (local coordinates in the current port).
- colors: Colors to draw with. Use nil for default colors.
-
- ProgressBarColor and ProgressBarColorsRGB: Sets up a color record.
-
- AdvanceProgressBar: Updates the progress bar. The pointer to the progress bar is the only
- parameter.
-
- FinishProgressBar: Dispose the progress bar. It fills the progress bar to indicate that the
- operation is completed, but does NOT erase it. The pointer to the
- progress bar is the only parameter.
- */
-
-
- typedef Ptr ProgressBarColorPtr;
- typedef Ptr ProgressBarPtr;
-
- pascal ProgressBarPtr InitProgressBar(short prefFile, short resID, Rect bounds, ProgressBarColorPtr colors);
- pascal ProgressBarColorPtr ProgressBarColors(short frameRed, short frameGreen, short frameBlue,
- short backRed, short backGreen, short backBlue,
- short foreRed, short foreGreen, short foreBlue);
- pascal ProgressBarColorPtr ProgressBarColorsRGB(RGBColor frame, RGBColor back, RGBColor fore);
- pascal void AdvanceProgressBar(ProgressBarPtr thePB);
- pascal void FinishProgressBar(ProgressBarPtr thePB);
-
-